#ifndef __TASK_HPP__
#define __TASK_HPP__

#include <iostream>
#include <string>
#include <functional>

typedef std::function<void(int,std::string,uint16_t,std::string)> fun_t;

class Task
{
public:
    Task(uint16_t port,std::string ip,int sock,fun_t fun)
        :_port(port)
        ,_ip(ip)
        ,_sock(sock)
        ,_fun(fun)
    {}

    Task()
    {}

    void operator()(std::string name)
    {
        _fun(_sock,_ip,_port,name);
    }

    ~Task()
    {}

private:
    uint16_t _port;
    std::string _ip;
    int _sock;
    fun_t _fun;
};

#endif